home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ETO Development Tools 4
/
ETO Development Tools 4.iso
/
Tools - Objects
/
Virtual User 1.0
/
Example Scripts
/
SimpleSample.vu
< prev
next >
Wrap
Text File
|
1991-01-25
|
4KB
|
126 lines
#
# File SimpleSample.vu
#
# Contains: A script which creates a folder with 3 sub-folders and does
# some simple user actions at a slow pace for you to observe.
# Note that all lines starting with a '#' is a comment
# (like this one).
#
#
# Starting Configuration: In order for the script to run properly, the target
# should be running Finder with all windows closed and one disk
# icon selected. The target Macintosh should have a Printer
# software installed. If you have access to a printer then use
# the Chooser to select one.
#
# After Effects: This script creates a folder called "..VUSimpleSample.." in
# the volume selected initially. Please throw it in the trash
# after you execute this script once.
#
# Note: To stop the script execution while its running type Cmd-.
# ie., Press the Command Key and type '.' (period).
#
# Written by: Rick Violet
#
# Copyright: © 1990 by Apple Computer, Inc., all rights reserved.
#
# Change History:
#
# 1/21/90 Rick Created first draft
# 1/24/90 naga Edited the script and comments
#
################################################################################
######## Create a new folder window
################################################################################
#Tell VU to slow its movements for Demonstration purpose
Patience(2);
MouseSpeed(10);
# Open the root window of the selected volume, by selecting "Open" from the
# file menu.
Select [ menuitem t:"Open" ];
# Unify the window's name into a variable (Volume_Name) for later use.
match[ window o:1 t:?Volume_Name ];
# Initialize a variable for our folder's name.
Our_Window_Name := "..VUSimpleSample..";
# Create a new folder by selecting 'New', using the key equivalent.
pressKey k:{ commandKey };
type k:{"n"};
releaseKey k:{ commandKey };
# We can rename the folder by simply typing.
Type k:{ Our_Window_Name };
# Open the new folder's window by selecting "Open" from the file menu.
Select [ menuitem t:"Open" ];
# Check for 'Name already taken' dialog
if match[ button t:"Ok" w:0 ]
begin
println "Target not setup to run this script";
println "Please trash the '{Our_Window_Name}' folder.";
exit;
end;
# Select and then Close the root window.
# the variable Volume_Name contains the window's title.
Select[ window t:Volume_Name ];
Close[ window t:Volume_Name ];
# Create 3 new folders in this folder using Command-n
pressKey k:{ commandKey };
type k:{"nnn"};
releaseKey k:{ commandKey };
# Resize the window to be thin and as tall as the screen.
# First find the rectangle of the main screen
match[ screen main:true r:?Main_Screen_Rect];
# Drag the window to the top-left corner of the screen
Drag [ window o:1 ] a:{ Main_Screen_Rect[1],
Main_Screen_Rect[2] + 20 }; # bump down 20 for Menubar
# Now resize the window.
Size [ window o:1 ] w:180 h:(Main_Screen_Rect[4] - Main_Screen_Rect[2] - 20 );
# View the window by small icon.
Select[ menuitem t:"by Small Icon" m:"View" ];
# Force Finder to clean up the window
pressKey k:{ optionKey };
Select[ menuitem t:"Clean up" ];
releaseKey k:{ optionKey };
# Zoom the window out
Zoom [ window o:1 ];
# Do Page setup
Select[ menuitem t:"Page Setup…" m:"File"];
# If Page setup dialog comes up.
if match [ radioButton t:"US letter" w:1 ]
begin
Select [ radioButton t:"US letter" w:1 ];# Select a radio button, "US letter"
# Check any check boxes that are currently un-checked in the front window
# First, collect the list of all un-checked boxes in the front window
All_Marked_CheckBoxes := Collect[ checkbox s:{0,1} w:1 ]!;
For each CB in All_Marked_CheckBoxes # For each one in the list
Select [checkBox t:CB.t r:CB.r w:1]; # check the box
end;#if Page setup dialog comes back
Select[ button t:'Ok' w:1]; # dissmiss dialog
# Close the window titled '..VUSimpleSample..'
Close [window t: Our_Window_Name];
# Open the root volume window
Select [menuItem t:'Open' m:'File'];
println "Please, don't forget to trash the '{Our_Window_Name}'∂n",
"folder on your target Macintosh";